import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { App } from 'ionic-angular';
/**
 * Generated class for the DemoTab_1Page page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-demo-tab-1',
  templateUrl: 'demo-tab-1.html',
})
export class DemoTab_1Page {
  constructor(public navCtrl: NavController, public navParams: NavParams,public app:App) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad DemoTab_1Page');
  }
  go_home() {
    // this.navCtrl.pop();
    //导航堆栈还存在的情况返回根用以下代码
    // this.navCtrl.popToRoot();
    //完全替换堆栈根的方式用以下方法
    this.app.getRootNav().setRoot("HomePage");
  }
}
